package ui.footer 
{
	import com.somerandomdude.coordy.layouts.twodee.HorizontalLine;
	import com.somerandomdude.coordy.layouts.twodee.ILayout2d;
	import flash.display.MovieClip;
	import flash.events.Event;
	import model.Model;
	
	/**
	 * ...
	 * @author usual
	 */
	public class FooterMenu extends MovieClip 
	{
		private var _menu:MovieClip;
		private var _xmlData:XML;
		private var _layout:ILayout2d;
		public function FooterMenu() 
		{
			_xmlData = Model.instance.uiData;
			addEventListener(Event.ADDED_TO_STAGE, build);
		}
		
		private function build(e:Event):void 
		{
			removeEventListener(Event.ADDED_TO_STAGE, build);
			addMenu();
		}
		
		private function addMenu():void 
		{
			_menu = new MovieClip();
			addChild(_menu);
			_layout = new HorizontalLine(21)
			var ln:Number = _xmlData.label.length();
			for (var i:int = 0; i < ln; i++) 
			{
				if (_xmlData.label[i].@group == "menu")
				{
					var item:FooterMenuItem = new FooterMenuItem(_xmlData.label[i]);
					_menu.addChild(item);
					_layout.addNode(item);
				}
				
			}
			
		}
		
	}

}